<template>
    <div style="width: 50%;margin-top: 10%">

       <el-form :model="form1" label-width="80px">

         <el-form-item label="商品数量">
           <el-input v-model="form1.quantity" @change="pricechange"></el-input>
         </el-form-item>
         <el-form-item label="商品单价">
           <el-input v-model="form1.price" ></el-input>
         </el-form-item>

         <el-form-item label="总金额">
           {{form1.zongjine}}
         </el-form-item>

         <el-form-item>
           <el-button type="primary" @click="onSubmit">支付</el-button>
         </el-form-item>

       </el-form>

    </div>
</template>

<script>
  import {gethtSet} from "@/api/caiwu/caiwujs";

  export default {
        name: "pczhifu",
        data(){
          return{
            form1:{
              quantity:0,
              price:1.00,
              zongjine:0.00,
            }
          }
        },
        methods:{
          pricechange(){
             this.form1.zongjine=this.form1.quantity*this.form1.price;
          },
          onSubmit(){
            gethtSet(this.form1).then((response)=>{
               //前往扫码支付页面
              console.log(JSON.stringify(response))
               window.sessionStorage.setItem("payhtml",response)
               this.$router.push({path: '/saomapay'});
             })
          }
        }
    }
</script>

<style scoped>

</style>
